package org.example.back.mapper.advice;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;

@Mapper
public interface ChronicDiseaseAdviceMapper {
    // 查找缓存的建议
    String findAdvice(@Param("userId") Integer userId,
                      @Param("type") String type,
                      @Param("adviceDate") LocalDate adviceDate,
                      @Param("diseaseId") Integer diseaseId);

    // 插入新建议
    void insertAdvice(@Param("userId") Integer userId,
                      @Param("type") String type,
                      @Param("adviceDate") LocalDate adviceDate,
                      @Param("advice") String advice,
                      @Param("diseaseId") Integer diseaseId);

    // 删除指定类型的所有建议缓存
    void deleteAdviceByType(@Param("type") String type);

    // 删除指定用户和类型的建议缓存
    void deleteAdviceByUserAndType(@Param("userId") Integer userId, @Param("type") String type);

    // 删除指定用户、疾病和类型的建议缓存
    void deleteAdviceByUserDiseaseAndType(@Param("userId") Integer userId,
                                          @Param("diseaseId") Integer diseaseId,
                                          @Param("type") String type);
}